<?php /* Smarty version 2.6.27, created on 2019-11-04 17:32:01
         compiled from common/data_tables.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'default', 'common/data_tables.tpl', 45, false),array('modifier', 'count', 'common/data_tables.tpl', 120, false),array('modifier', 't', 'common/data_tables.tpl', 138, false),)), $this); ?>
<style>
.close{color:red; background:#fff; border:solid 1px #AAAAAA; border-radius:4px; padding: 2px 5px;}
.close:hover{ background:#F3F3F3;}
.search_float{float:left; padding:5px;height:auto;}
#server-list{display: none;}
#server-list label{ display: inline-block;width: 105px;height: 18px;}
</style>
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all <?php echo $this->_tpl_vars['otherData']['tipsID']; ?>
" style="margin-bottom:8px; padding:10px; display:none;">
	<span style="float:right"><a class="close" href="#" onClick="$(this).parent().parent().slideUp();">X</a></span>
	<div id="TipsCont"></div>
</div>
<!-- 
使用方法：
1. 在$otherData中传入标识唯一的tipsID作为class
2. 需要tips数据时：
    $('.tipsID').slideDown();
    $('.tipsID').children("#TipsCont").html(html);
 -->

<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="<?php echo $this->_tpl_vars['otherData']['id']; ?>
">

    <!----------------------- datatable_header ---------------------------------->
	<div id="datatable_header">
	    <?php echo $this->_tpl_vars['otherData']['header']; ?>

	</div>

    <!----------------------- datatable_search ---------------------------------->
	<div class="datatable_search" style="padding:5px;">
        <div class="search_content">
            <?php if ($this->_tpl_vars['otherData']['searchHeader']): ?>
                <div class="search_float">
                    <?php echo $this->_tpl_vars['otherData']['searchHeader']; ?>

                </div>
            <?php endif; ?>

            <?php $_from = $this->_tpl_vars['searchFields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']):
?>
                <div class="search_float search_field field_<?php echo $this->_tpl_vars['key']; ?>
" type="<?php echo $this->_tpl_vars['item']['type']; ?>
">

                    <?php if ($this->_tpl_vars['item']['title']): ?><?php echo $this->_tpl_vars['item']['title']; ?>
:&nbsp;&nbsp;<?php endif; ?>

                    <?php if ($this->_tpl_vars['item']['type'] == 'cp' || $this->_tpl_vars['item']['type'] == 'scp' || $this->_tpl_vars['item']['type'] == 'server'): ?>
                        <?php echo $this->_tpl_vars['item']['value']; ?>


                    <?php elseif ($this->_tpl_vars['item']['type'] == 'input'): ?>
                        <input value="<?php echo ((is_array($_tmp=@$this->_tpl_vars['item']['value'])) ? $this->_run_mod_handler('default', true, $_tmp, '') : smarty_modifier_default($_tmp, '')); ?>
" <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;">

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'checkbox'): ?>
                        <label>
                            <input type="checkbox" value="<?php echo ((is_array($_tmp=@$this->_tpl_vars['item']['value'])) ? $this->_run_mod_handler('default', true, $_tmp, '') : smarty_modifier_default($_tmp, '')); ?>
"  style="margin-top: 4px" <?php if ($this->_tpl_vars['item']['checked']): ?>checked<?php endif; ?>>
                            <span style="margin-top: -10px"><?php echo $this->_tpl_vars['item']['text']; ?>
</span>
                        </label>

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'date'): ?>
                        <input value="<?php echo ((is_array($_tmp=@$this->_tpl_vars['item']['value'])) ? $this->_run_mod_handler('default', true, $_tmp, '') : smarty_modifier_default($_tmp, '')); ?>
" <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;" class="datepicker">&nbsp;&nbsp;

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'range'): ?>
                        <input <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;">&nbsp;~&nbsp;
                        <input <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;">

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'range_date'): ?>
                        <input value='<?php echo $this->_tpl_vars['item']['value'][0]; ?>
' <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;" class="datepicker">&nbsp;~&nbsp;
                        <input value='<?php echo $this->_tpl_vars['item']['value'][1]; ?>
' <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;" class="datepicker">

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'range_time'): ?>
                        <input type="text" value='<?php echo $this->_tpl_vars['item']['value'][0]; ?>
' <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;" class="datetimepicker">&nbsp;~&nbsp;
                        <input type="text" value='<?php echo $this->_tpl_vars['item']['value'][1]; ?>
' <?php if ($this->_tpl_vars['item']['size']): ?>size="<?php echo $this->_tpl_vars['item']['size']; ?>
"<?php endif; ?> style="width:<?php echo $this->_tpl_vars['item']['input_width']; ?>
px;" class="datetimepicker">

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'select'): ?>
                        <select>
                        <?php $_from = $this->_tpl_vars['item']['value']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['it']):
?>
                            <?php if (isset ( $this->_tpl_vars['item']['default'] )): ?>
                                <option value="<?php echo $this->_tpl_vars['key']; ?>
" <?php if ($this->_tpl_vars['item']['default'] == $this->_tpl_vars['key']): ?>selected='selected'<?php endif; ?>><?php echo $this->_tpl_vars['it']; ?>
</option>
                            <?php else: ?>
                                <option value="<?php echo $this->_tpl_vars['key']; ?>
"><?php echo $this->_tpl_vars['it']; ?>
</option>
                            <?php endif; ?>
                        <?php endforeach; endif; unset($_from); ?>
                        </select>

                    <?php elseif ($this->_tpl_vars['item']['type'] == 'checkboxlist'): ?>
                        <?php echo $this->_tpl_vars['item']['value']; ?>


                    <?php endif; ?>
                </div>
            <?php endforeach; endif; unset($_from); ?>

            <?php if ($this->_tpl_vars['searchFields']): ?>
                <div style="float:left; padding:5px;">
                    <input type="button" class="datatable_search_button gbutton" value="搜索" />
                </div>
            <?php endif; ?>

            <?php if ($this->_tpl_vars['otherData']['searchFooter']): ?>
                <div class="search_float">
                    <?php echo $this->_tpl_vars['otherData']['searchFooter']; ?>

                </div>
            <?php endif; ?>
	        <div style="clear:both;"></div>
	    </div>
	</div>


    <!-------------------------- tableHeader ------------------------------------->
    <?php if ($this->_tpl_vars['otherData']['tableHeader']): ?>
        <div style="margin: 10px 0 10px 10px">
            <?php echo $this->_tpl_vars['otherData']['tableHeader']; ?>

        </div>
    <?php endif; ?>

    <!---------------------------- showFields ----------------------------------->
	<table cellpadding="0" cellspacing="0" border="0" class="table_list">
	    <thead>
	        <tr height="44px">
	        <?php $_from = $this->_tpl_vars['showFields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
	            <th <?php if ($this->_tpl_vars['item']['width']): ?>width="<?php echo $this->_tpl_vars['item']['width']; ?>
"<?php endif; ?>><?php echo $this->_tpl_vars['item']['title']; ?>
</th>
	        <?php endforeach; endif; unset($_from); ?>
	        </tr>
	    </thead>
	    <tbody>
	        <tr>
	            <td colspan="<?php echo ((is_array($_tmp=$this->_tpl_vars['showFields'])) ? $this->_run_mod_handler('count', true, $_tmp) : count($_tmp)); ?>
" class="dataTables_empty"></td>
	        </tr>
	    </tbody>
	
	    <tfoot>
	        <tr>
	            <?php $_from = $this->_tpl_vars['showFields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
	            <th><?php echo $this->_tpl_vars['item']['title']; ?>
</th>
	            <?php endforeach; endif; unset($_from); ?>
	        </tr>
	    </tfoot>
	</table>
</div>


<script type="text/javascript">
<?php echo ((is_array($_tmp=@$this->_tpl_vars['otherData']['js'])) ? $this->_run_mod_handler('default', true, $_tmp, '') : smarty_modifier_default($_tmp, '')); ?>

$('.datepicker').datepicker();
var timepickerlang = {timeText: '<?php echo ((is_array($_tmp='时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
', hourText: '<?php echo ((is_array($_tmp='小时')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
', minuteText: '<?php echo ((is_array($_tmp='分钟')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
', currentText: '<?php echo ((is_array($_tmp='现在')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
', closeText: '<?php echo ((is_array($_tmp='确定')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
'}
$('.datetimepicker').datetimepicker(timepickerlang);
$('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .datatable_search .title').toggle(function(){
    $('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .search_content').slideUp();
},function(){
    $('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .search_content').slideDown();
});

var $<?php echo $this->_tpl_vars['otherData']['id']; ?>
 = $('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .table_list').dataTable({
    "bProcessing": true,
    "bServerSide": true,
    "iDisplayLength": <?php echo $this->_tpl_vars['otherData']['iDisplayLength']; ?>
, 
    "bLengthChange": true,
    "bStateSave": <?php if ($this->_tpl_vars['otherData']['bStateSave'] == true): ?>true<?php else: ?>false<?php endif; ?>,
    "bFilter": true,
    "sPaginationType": "full_numbers", 
    "sAjaxSource": "<?php echo $this->_tpl_vars['ajaxSource']; ?>
",
    "aaSorting": [[ <?php echo $this->_tpl_vars['otherData']['sortCol']; ?>
, "<?php echo $this->_tpl_vars['otherData']['sortDir']; ?>
" ]],
    'bSort' : <?php echo $this->_tpl_vars['otherData']['bSort']; ?>
,
    "oLanguage": {
    "sUrl": "style/js/dt_cn.txt"
    },
    "aoColumns": [
		<?php echo $this->_tpl_vars['aoColumns']; ?>

     ],
     "sDom": '<?php if ($this->_tpl_vars['otherData']['sDom']): ?><?php echo $this->_tpl_vars['otherData']['sDom']; ?>
<?php else: ?><"top"lp>rt<"bottom"ip><"clear"><?php endif; ?>'
});

$('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .table_list tbody tr').live('mouseover', function () {
    $(this).addClass('row_selected');
}).live('mouseout', function () {
    $(this).removeClass('row_selected');
});


$('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .datatable_search input').keydown( function (event) {
    if(event.keyCode==13){
    	$('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .datatable_search_button').trigger("click");
    }
});
$('.select-server').click(function(event) {
	$('#server-list').toggle();
});
function getFilter() {
	var data = new Array();
	$("#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .search_field").each(function(){
		var type = $(this).attr('type');
		var value = '';
		if(type == 'input' || type == 'select'){
			value = $(this).find(type).val();
		}else if(in_array(type, ['range', 'range_date', 'range_time'])){
			var range = new Array();
			$(this).find('input').each(function(){
				range.push($(this).val());
			});
			value = range.join('|');
		}else if(type == "date"){
			value = $(this).find("input").val();
		}
		else if (type == 'cp') {
			value = JSON.stringify(getCp())
			//console.log(value)
		}
		else if (type == 'scp')
			value = JSON.stringify(getScp())
		else if (type == 'checkbox' && $(this).find('input[type="checkbox"]')[0].checked)
			value = 1
		else if( type == 'checkboxlist')
		{
			console.log(11111);
			$('#server-list .server1').each(function(index, el) {
				if( $(this).prop('checked'))
					value += $(this).val() + ',';
			});
		}
        else if(type == 'server')
        {
            value = getServerId();
        }
		data.push(value);

	});
	return data
}
$('#<?php echo $this->_tpl_vars['otherData']['id']; ?>
 .datatable_search_button').click(function(){
	$<?php echo $this->_tpl_vars['otherData']['id']; ?>
.fnMultiFilter(getFilter());
});
$<?php echo $this->_tpl_vars['otherData']['id']; ?>
.fnMultiFilter(getFilter());
</script>